﻿using System;
using System.Collections.Generic;
using System.Text;
using HtmlAgilityPack;

namespace ihongma.WebData
{
    public class Class1
    {

     public   HtmlDocument dfsa;
     public string dd()
     {
         string str = "";
         dfsa = new HtmlDocument();
         string html = HttpRequestHelper.GetPageSourceByUrl("http://www.open-open.com/ajax/", "utf-8");
         dfsa.LoadHtml(html);
         HtmlNode hn = dfsa.GetElementbyId("sidebar");
         HtmlNodeCollection nodelist = hn.SelectNodes("//dl[1]/dd[6]");
         HtmlNode temp = null;
         foreach (HtmlNode h in nodelist)
         {
             temp = HtmlNode.CreateNode(h.OuterHtml);
             string text = "t:" + temp.SelectSingleNode("//a").InnerText;
             string href = "h:" + temp.SelectSingleNode("//a").Attributes["href"].Value;
             //HtmlNode temp = null;  
             str = str + text + href + "</br>";
         }
         return str;
         //HttpRequestHelper helper=new HttpRequestHelper();
         //HttpRequestHelper.g
         //  dfsa = new HtmlDocument();
         //dfsa.LoadHtml();
     }
    }
}
